U3. Files
  UtilIt provides a high level interface to the File Manager that facilitates opening of the standard file dialogs, tracking file locations, and resetting file types.

StdOpn  201  b,c,d,uString,uName,uResult,uI2
  Displays standard "Open" file dialog where b, c, and d define the initial position of the dialog (see the MovRec command in "Windows" topic), uName (if not empty) is used to redefine the text displayed in the "Open" button, and uString can contain up to 21 12-character "records" to designate file filtering.
  Each 12-character file filtering "record" in uString consists of an optional 4-character file type, 4-character file creator, and 1 to 4 character extension (w/o a leading ".").  Use spaces to designate entries that should be ignored, and all records except the last record must be exactly 12 characters long.  "TEXTMYPGtextPICT    pic DATA", for example, consists of three records which would cause UtilIt to display all files of type "TEXT" and creator "MYPG" with the extension ".text", and all files of type "PICT" with the extension ".pic", and all files of type "DATA".  If uString is empty, then all files are displayed (no filtering is done).
  When the dialog is closed, the variable uResult returns with the button pressed (1 = Open, 2 = Cancel).  If the Open button is pressed, then uName is set equal to the name of the file, the default volume or directory is set to the disk or HFS folder which contains the file, uI2 is set equal to the working directory reference number, and uString is set equal to the type, creator, and extension of the chosen file in a single filter record like that described above.
  For example, suppose you wished to have the user choose a file from a standard file dialog that showed only files of type "TEXT" and creator "MYPG", had "Run" as its default button, and was centered horizontally, 1/3 from the top of the main screen.  The following code fragment would do this: 

uString := 'TEXTMYPG';

uName := 'Run';

FaceIt(nil,StdOpn,0,0,4,1);

if (uResult = 1) then

 [uName contains chosen file name]
NOTE:  When filtering by creator, remember that programs under development, as well as the files they create, may not yet have been given the proper creator designation.

StdSav  202  b,c,d,uString,uName,uResult,uI2
  Displays the standard "Save As" dialog where b, c, and d define the initial position of the dialog (see MovRec in "Windows" topic), uString is used as the prompt string, and uName as the default file name.
  When the dialog is closed, uResult returns the button pressed (1 = Save, 2 = Cancel).  If the Save button was pressed, then uName is set equal to the file name entered by the user, the default volume or directory is set to the disk or HFS folder selected by the user, and uI2 is set equal to the working directory reference number.

GetRef  205  a,uI2,uResult
  Returns in uI2 the working directory reference number designated by a where a = 0 returns the current directory and a = 1 returns the active System folder. The variable uResult will contain a value less than zero (an OSErr) if an error occurs.  uString and uName are not changed by calls to GetRef.  This command is primarily provided for those programmers who do not have access to the high-level toolbox routine GetVol.

SetRef  206  a,uResult
  Resets the current directory to that designated by a where a is either a working directory reference number or a = 1 designates the active System folder.  (If a = 0, the current directory is not changed.)  uResult will return a value less than zero (an OSErr) if an error occurs.  uString and uName are not changed by calls to SetRef.  This command is primarily provided for programmers who do not have access to the high-level toolbox routine SetVol.
  FORTRAN PROGRAMMERS:  Note that parameter a must be a 4-byte integer even though working directory reference numbers are 2 bytes in length.  Don't make the mistake, for example, of saving a reference number in a 2-byte integer and then attempt to pass that variable in a call to SetRef.  Save reference numbers in 4-byte integer variables and pass these back to SetRef:
 integer*4 saveRef
 ...
 call FaceIt(0,GetRef,0,0,0,0)
 saveRef = uI2  !integer*2->*4 w/ sign preserved
 ...
 call FaceIt(0,SetRef,saveRef,0,0,0)

SetTyp  208  a,uString,uName,uResult
  Resets the file type and/or creator of the file whose name is given by uName in the directory designated by a where a is either a working directory reference number, or a = 0 designates the current directory, or a = 1 designates the active System folder.  The new file type and creator are designated by the first 8 characters of uString using the same scheme as that defined above for StdOpn.  uResult will return a value less than zero (an OSErr) if an error occurs.  This command is primarily provided for those programmers who do not have access to the high-level toolbox routine SetFInfo.